package cn.rtangyy.seckilling.service.impl;

import cn.rtangyy.seckilling.dao.SeckillGoodsDao;
import cn.rtangyy.seckilling.entity.SeckillGoods;
import cn.rtangyy.seckilling.service.SeckillGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SeckillGoodsServiceImpl implements SeckillGoodsService {

    @Autowired
    private SeckillGoodsDao secKillGoodsDao;

    @Override
    public SeckillGoods findByGoodsId(Long goodId) {
        return secKillGoodsDao.querySecKillGoodsByGoodsId(goodId);
    }

    @Override
    public void updateById(SeckillGoods seckillGoods) {
        secKillGoodsDao.updateById(seckillGoods);
    }

    @Override
    public boolean updateByIdPositiveStock(SeckillGoods seckillGoods) {
        return secKillGoodsDao.updateByIdPositiveStock(seckillGoods);
    }
}
